package com.sys.sysserver.mapper;

import com.sys.sysserver.domain.dto.UserQueryDTO;
import com.sys.sysserver.domain.po.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface UserCrudMapper {

    List<User> page(UserQueryDTO userQueryDTO);


    @Select("select * from `user` where id = #{id} and del = 0")
    User getById(Integer id);

    @Update("update `user` set username = #{username}, password = #{password} , update_time = #{updateTime} where id = #{id}")
    void edit(User user);

    void del(List<Integer> ids);

    @Insert("insert into `user`(username, password, create_time, update_time, del) values(#{username}, #{password}, #{createTime}, #{updateTime}, #{del})")
    void add(User user);
}
